package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.CourseHoursMember;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CourseHoursMemberRepository extends JpaRepository<CourseHoursMember, Long> {
    
    // 根据教学课时ID查询成员
    List<CourseHoursMember> findByCourseHoursId(@Param("courseHoursId") Long courseHoursId);
    
    // 根据教师姓名查询成员
    List<CourseHoursMember> findByUserName(@Param("userName") String userName);
    
    // 根据教学课时ID删除成员
    void deleteByCourseHoursId(@Param("courseHoursId") Long courseHoursId);
    
    // 根据教学课时ID和教师姓名查询成员
    CourseHoursMember findByCourseHoursIdAndUserName(@Param("courseHoursId") Long courseHoursId, @Param("userName") String userName);
}
